home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 September
/
Ahoy_Magazine_86-09_1986_Double_L.d64
/
compact pix.txt
< prev
next >
Wrap
Text File
|
2022-10-26
|
2KB
|
59 lines
PICTURE COMPRESSION SYSTEM
by Colin Thompson
and David Stidolph
One look in almost any club C64 disk
library will reveal a multitude of
picture disks. Many of the disks
contain "BITMAPS". Bitmaps are
monocolor (black and white) pictures
8000 bytes long (32 blocks on disk).
Normally they take 30 seconds to load
into memory.
In Volume 6, Issue 4 of the
Transactor, Chris Zamara published a
machine code program to shrink BASIC
bitmap pictures by coding them. We
took his idea and wrote a COMAL 0.14
machine code routine that does this.
Demonstration programs, sample
pictures, and the machine code are on
this Ahoy disk.
The idea of compression is simple.
Much of any picture is blank space
(all bytes on). To shrink the bitmap,
the bytes are encoded. When three
consecutive bytes or more are the
same, we code them. First we send a
byte 254 followed by the byte to
repeat, and finally the number of
bytes to show. For instance, 100
consecutive bytes of zero's would be
coded 254, 0, 100. This would save 97
bytes. If a single byte 254 is
encountered, we code 254, 254, 1.
Random pictures will not shrink much,
but most files are reduced by 40-80%
(making them smaller and faster in
loading).
This program allows you to convert
BASIC or COMAL bitmaps to compacted
bitmaps, view the compacted bitmaps,
and update the two SEQ files needed
by the programs. Make sure to update
the directory file before trying to
compact new bitmaps.
There are three COMAL 0.14 programs
on this disk that work together to
allow you to compact bitmaps, view
compressed pictures, and maintain a
database of the pictures on a given
disk. The files " directory" and
" compact pix" hold the names of the
pictures on the disk.